#define BLINKER_PRINT Serial
#define BLINKER_WIFI
#include <Arduino.h>
#include <Blinker.h>
#include <Adafruit_SSD1306.h>

char ssid[] = "Your WiFi network SSID or name";
char pswd[] = "Your WiFi network WPA password or WEP key";

#define SLIDER_1 "SliderKey"

Adafruit_SSD1306 *SSD1306 = nullptr;
os_timer_t timer_uart_task;
os_timer_t timer_blinker_task;

void uart_task(void* any){
  //get ip
  //get status
  //get cpu temp and %
  //get ram and %
}

void blinker_task(void* any){
  Blinker.run();
  if (Blinker.available()) {
      BLINKER_LOG2("Blinker.readString(): ", Blinker.readString());

      Blinker.vibrate();
      
      uint32_t BlinkerTime = millis();
      Blinker.print(BlinkerTime);
      Blinker.print("millis", BlinkerTime);
  }
  BLINKER_LOG2("Slider read: ", Blinker.slider(SLIDER_1));
}

void setup(){
    Serial.begin(115200);

    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);

    Blinker.begin(ssid, pswd);
    Blinker.wInit(SLIDER_1, W_SLIDER);
    SSD1306 = new Adafruit_SSD1306(128, 64, 1, 2, 3);
    os_timer_disarm(&timer_uart_task);
    os_timer_setfn(&timer_uart_task, uart_task, nullptr);
    
    os_timer_disarm(&timer_blinker_task);
    os_timer_setfn(&timer_blinker_task, blinker_task, nullptr);

    os_timer_arm(&timer_uart_task, 500, true);
    os_timer_arm(&timer_blinker_task, 250, true);
}



void loop(){
}